function nameDecorator(target: any, key: any): any {
  alert(3);
  const descriptor: PropertyDescriptor = {
    configurable: false,
    enumerable: false,
    writable: false,
  };
  return descriptor;
}

class Test {
  @nameDecorator
  name: string;

  constructor() {
    this.name = "tom";
  }
}

const test = new Test();
console.log(test.name);
test.name = "jerry"; // 这是不允许修改的，在装饰器中设置了不可修改
console.log(test.name);
